//
//  BKSearchViewController.m
//  baokaodaxue
//
//  Created by dangyangyang on 15/5/25.
//  Copyright (c) 2015年 报考大学. All rights reserved.
//

#import "BKSearchViewController.h"
#import "BKResultOfMatchingScoreViewController.h"
#import "BKMatchingScoreViewController.h"
#import "BKMatchingProvinceViewController.h"
#import "BKHistoryViewController.h"
#import "BKLiuXueViewController.h"
#import "BKZhiYuanViewController.h"
#import "BKMatchingScholarshipViewController.h"
#import "BKZiZhuZhaoShengViewController.h"
#import "BKMianXueFeiViewController.h"
#import "BKShangShiViewController.h"
#import "BKMatchingZhuanYeViewController.h"
#import "BKKongZhiXianViewController.h"
#import "LoginViewController.h"

#import <ShareSDK/ShareSDK.h>
#import <TencentOpenAPI/QQApiInterface.h>
#import <TencentOpenAPI/TencentOAuth.h>
#import "WXApi.h"
#import "WeiboApi.h"
#import "WeiboSDK.h"
#import <RennSDK/RennSDK.h>

@interface BKSearchViewController ()

@end

@implementation BKSearchViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    

}
- (IBAction)shareBtnClick:(id)sender {
    
    NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"ShareSDK" ofType:@"png"];
    
    //构造分享内容
    id<ISSContent> publishContent = [ShareSDK content:@"考得好更要报的好－报考大学"
                                       defaultContent:@"考得好更要报的好－报考大学"
                                                image:[ShareSDK imageWithPath:imagePath]
                                                title:@"报考大学"
                                                  url:@"http://www.baokaodaxue.com"
                                          description:@"考得好更要报的好－报考大学"
                                            mediaType:SSPublishContentMediaTypeNews];
    //创建弹出菜单容器
    id<ISSContainer> container = [ShareSDK container];
    [container setIPadContainerWithView:sender arrowDirect:UIPopoverArrowDirectionUp];
    
    //弹出分享菜单
    [ShareSDK showShareActionSheet:container
                         shareList:nil
                           content:publishContent
                     statusBarTips:YES
                       authOptions:nil
                      shareOptions:nil
                            result:^(ShareType type, SSResponseState state, id<ISSPlatformShareInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {
                                
                                if (state == SSResponseStateSuccess)
                                {
                                    NSLog(@"success");
                                }
                                else if (state == SSResponseStateFail)
                                {
                                    NSLog(@"fail");
                                }
                            }];
    
    
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    UITabBarController *tabBarViewController = (UITabBarController *)[[[UIApplication sharedApplication] keyWindow] rootViewController];
    [tabBarViewController.tabBar setBarTintColor:[UIColor colorWithRed:0.459 green:0.839 blue:0.863 alpha:1.000]];
}

- (void)viewWillAppear:(BOOL)animated
{

    [super viewWillAppear:animated];
    UITabBarController *tabBarViewController = (UITabBarController *)[[[UIApplication sharedApplication] keyWindow] rootViewController];
    if ([tabBarViewController isKindOfClass:[UITabBarController class]]) {
        [tabBarViewController.tabBar setBarTintColor:[UIColor colorWithRed:57.0/255.0 green:99.0/255.0 blue:101/255.0 alpha:1.000]];
    }
    
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (BOOL)automaticallyAdjustsScrollViewInsets{

    return NO;
    
}
- (IBAction)matchingSomething:(id)sender {
    

    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    if ([userDefaults objectForKey:@"Cookie"] ==nil){
        LoginViewController *login = [[LoginViewController alloc] initWithNibName:NSStringFromClass([LoginViewController class]) bundle:nil];
        [self presentViewController:login animated:YES completion:nil];
        return;
        
    
    }
      
    
    if ([sender isKindOfClass:[UIButton class]]) {
        UIButton *button = (UIButton *)sender;
        switch (button.tag) {
                
            case 8000:{
                
                
                BKMatchingScoreViewController *matchingScoreVC = [[BKMatchingScoreViewController alloc] initWithNibName:NSStringFromClass([BKMatchingScoreViewController class])
                                                                                                                 bundle:nil];
                
                [self.navigationController pushViewController:matchingScoreVC animated:YES];
            }
                break;
                
            case 8001:{
                
               
               //                BKZhiYuanViewController *zhiyuanVC = [[BKZhiYuanViewController alloc] initWithNibName:NSStringFromClass([BKZhiYuanViewController class]) bundle:nil];
//                [self.navigationController pushViewController:zhiyuanVC animated:YES];
            }
                break;
                
            case 8003:{
                BKHistoryViewController *history = [[BKHistoryViewController alloc] initWithNibName:NSStringFromClass([BKHistoryViewController class]) bundle:nil];
                [self.navigationController pushViewController:history animated:YES];
            }
                break;
                
            case 8002:{
//                BKMatchingProvinceViewController *prov = [[BKMatchingProvinceViewController alloc] initWithNibName:NSStringFromClass([BKMatchingProvinceViewController class]) bundle:nil];
//                [self presentViewController:prov animated:YES completion:nil];
            }
                break;
                
            case 8006:{
                BKMianXueFeiViewController *vc = [[BKMianXueFeiViewController alloc] initWithNib];
                [self.navigationController pushViewController:vc animated:YES];
            }
                break;
                
            case 8007:{
                BKMatchingScholarshipViewController *matchingScholarship = [[BKMatchingScholarshipViewController alloc] initWithNib];
                [self.navigationController pushViewController:matchingScholarship animated:YES];
            }
                break;
                
            case 8010:{
//                BKZiZhuZhaoShengViewController *ziZhuZhaoSheng = [[BKZiZhuZhaoShengViewController alloc] initWithNib];
////                [self.navigationController ];
            }
                break;
            case 8011:{
                BKShangShiViewController *ziZhuZhaoSheng = [[BKShangShiViewController alloc] initWithNibName:NSStringFromClass([BKShangShiViewController class]) bundle:nil];
                [self.navigationController pushViewController:ziZhuZhaoSheng animated:YES];
            }
                break;
                
            case 8022:{
                BKLiuXueViewController *liuxue = [[BKLiuXueViewController alloc] initWithNibName:NSStringFromClass([BKLiuXueViewController class]) bundle:nil];
                [self.navigationController pushViewController:liuxue animated:YES];
            }
                break;
                
            case 8031:{
            
                BKMatchingZhuanYeViewController *zhuanye = [[BKMatchingZhuanYeViewController alloc] initWithNibName:NSStringFromClass([BKMatchingZhuanYeViewController class]) bundle:nil];
                [self.navigationController pushViewController:zhuanye animated:YES];
                break;
                
            }
                
            case 8032:{
                
                BKKongZhiXianViewController *kongzhixian = [[BKKongZhiXianViewController alloc] initWithNibName:NSStringFromClass([BKKongZhiXianViewController class]) bundle:nil];
                [self.navigationController pushViewController:kongzhixian animated:YES];
                break;
                
            }
            case 8041:{
            
            
                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"更多功能即将开放,敬请期待" delegate:nil cancelButtonTitle:@"好的" otherButtonTitles:nil, nil];
                [alertView show];
                break;

            }
            default:
                break;
        }
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
